package cn.iocoder.yudao.module.biz.dal.mysql.contract.autocode;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.contract.autocode.result.vo.AutoCodeResultPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.contract.autocode.AutoCodeResultDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 编码生成记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface AutoCodeResultMapper extends BaseMapperX<AutoCodeResultDO> {
    default PageResult<AutoCodeResultDO> selectPage(AutoCodeResultPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AutoCodeResultDO>()
                .eqIfPresent(AutoCodeResultDO::getPartId, reqVO.getPartId())
                .eqIfPresent(AutoCodeResultDO::getGenIndex, reqVO.getGenIndex())
                .eqIfPresent(AutoCodeResultDO::getDeleted, reqVO.getDeleted())
                .eqIfPresent(AutoCodeResultDO::getCreateDept, reqVO.getCreateDept())
                .betweenIfPresent(AutoCodeResultDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(AutoCodeResultDO::getRemark, reqVO.getRemark())
                .orderByDesc(AutoCodeResultDO::getCodeId));
    }
}